package org.smartj2ee;

import javax.sql.DataSource;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.smartj2ee.db.DBDriverFactory;

import dbutils.QueryRunnerExample;
public class Activator implements BundleActivator {

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		context.addFrameworkListener(new FrameworkListener() {
			
			@Override
			public void frameworkEvent(FrameworkEvent event) {
				System.out.println("frameworkEvent:"+event.getBundle());
			}
		});
		context.addBundleListener(new BundleListener() {
			
			@Override
			public void bundleChanged(BundleEvent event) {
				System.out.println("bundleChanged:"+event.getBundle());
			}
		});
		QueryRunnerExample.main(null);
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}
	
  public static void main(String[] args) {
	  String driverClassName="com.mysql.jdbc.Driver",url="jdbc:mysql://localhost/test",username="root",password="123";
	  
	  
  }
}
